<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8" />
    
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  <title>
    Xshell6连接到虚拟机 |  Yolin
  </title>
  <meta name="generator" content="hexo-theme-yilia-plus">
  
  <link rel="shortcut icon" href="/favicon.png" />
  
  
<link rel="stylesheet" href="/css/style.css">

  
<script src="/js/pace.min.js"></script>


  

  

<link rel="alternate" href="/atom.xml" title="Yolin" type="application/atom+xml">
</head>

</html>

<body>
  <div id="app">
    <main class="content">
      <section class="outer">
  <article id="post-Xshell6连接到虚拟机" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h1 class="article-title sea-center" style="border-left:0" itemprop="name">
  Xshell6连接到虚拟机
</h1>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/03/12/Xshell6%E8%BF%9E%E6%8E%A5%E5%88%B0%E8%99%9A%E6%8B%9F%E6%9C%BA/" class="article-date">
  <time datetime="2020-03-12T02:46:02.000Z" itemprop="datePublished">2020-03-12</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/Linux/">Linux</a>
  </div>

      
      
<div class="word_count">
    <span class="post-time">
        <span class="post-meta-item-icon">
            <i class="ri-quill-pen-line"></i>
            <span class="post-meta-item-text"> 字数统计:</span>
            <span class="post-count">847字</span>
        </span>
    </span>

    <span class="post-time">
        &nbsp; | &nbsp;
        <span class="post-meta-item-icon">
            <i class="ri-book-open-line"></i>
            <span class="post-meta-item-text"> 阅读时长≈</span>
            <span class="post-count">3分钟</span>
        </span>
    </span>
</div>

      
    </div>
    

    
    
    <div class="tocbot"></div>





    

    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h1 id="一、查看IP地址"><a href="#一、查看IP地址" class="headerlink" title="一、查看IP地址"></a>一、查看IP地址</h1><h3 id="ip-addr"><a href="#ip-addr" class="headerlink" title="ip addr"></a>ip addr</h3><p>Centos7中,要查看IP地址,不再使用ifconfig命令,而是使用了<a href="">ip addr</a>命令。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ip addr</span><br></pre></td></tr></table></figure>
<p><img src="https://yolin121.oss-cn-beijing.aliyuncs.com/yolin/03120.png" alt="addr"></p>
<h3 id="详解"><a href="#详解" class="headerlink" title="详解"></a>详解</h3><ul>
<li><strong>lo</strong>：全称loopback，是回环地址，经常被分配到127.0.0.1地址上，用于本机通信，经过内核处理后直接返回，不会在任何网络中出现。</li>
<li><strong>link/loopback</strong>：这个是MAC地址，唯一的，一块网卡一个MAC。</li>
<li><strong>inet</strong>：网卡上绑定的IP地址</li>
<li><strong>inet6</strong>：IPV6地址，暂时没有，预留。</li>
<li><strong>ens33</strong>：网卡名，如果有多块网卡，会有多个ens或其它名称。    </li>
<li><strong>网络设备状态标识</strong>：&lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt;</li>
<li><strong>carrier</strong>：也就是载波，它的值越低越好。通常是物理层造成的，比如电缆问题、强电干扰等</li>
<li><strong>UP</strong>：网卡处于启动状态。<a id="more"></a></li>
<li><strong>BROADCAST</strong>：网卡有广播地址，可以发生广播包。</li>
<li><strong>MULTICAST</strong>：网卡可以发生多播包。</li>
</ul>
<h1 id="二、更改IP地址"><a href="#二、更改IP地址" class="headerlink" title="二、更改IP地址"></a>二、更改IP地址</h1><h3 id="查看本地ip"><a href="#查看本地ip" class="headerlink" title="查看本地ip"></a>查看本地ip</h3><p>Win+r  cmd打开命令行，输入</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ipconfig</span><br></pre></td></tr></table></figure>
<p><img src="https://yolin121.oss-cn-beijing.aliyuncs.com/yolin/03121.png" alt="ipconfig"></p>
<h3 id="出现错误："><a href="#出现错误：" class="headerlink" title="出现错误："></a>出现错误：</h3><p>169.254 开始的网段是属于系统保留地址，代表网卡未能获取到上级设备所分配的IP地址，还需要进一步设置，（本机ping不通虚拟机的话问题也在这里）<strong>如果你的ip是192.168开始 的网段不用考虑这一步，直接去下一步</strong></p>
<h4 id="①打开虚拟网络编辑器"><a href="#①打开虚拟网络编辑器" class="headerlink" title="①打开虚拟网络编辑器"></a>①打开虚拟网络编辑器</h4><p><img src="https://yolin121.oss-cn-beijing.aliyuncs.com/yolin/03122.png?x-oss-process=image/resize,m_fill,h_300,w_600" alt="wl"><br><img src="https://yolin121.oss-cn-beijing.aliyuncs.com/yolin/03123.png?x-oss-process=image/resize,m_fill,h_500,w_500" alt="xn"><br><img src="https://yolin121.oss-cn-beijing.aliyuncs.com/yolin/03124.png" alt="dhcp"></p>
<h4 id="②然后确定，接着打开网络适配器"><a href="#②然后确定，接着打开网络适配器" class="headerlink" title="②然后确定，接着打开网络适配器"></a>②然后确定，接着打开网络适配器</h4><p><img src="https://yolin121.oss-cn-beijing.aliyuncs.com/yolin/03125.png?x-oss-process=image/resize,m_fill,h_300,w_600" alt="wlspq"><br><img src="https://yolin121.oss-cn-beijing.aliyuncs.com/yolin/03126.png" alt="wlqj"></p>
<blockquote>
<p><strong>接着在NAT设置中将网关IP改成和物理机一样</strong></p>
</blockquote>
<h4 id="③点击确定，这一步就完成了"><a href="#③点击确定，这一步就完成了" class="headerlink" title="③点击确定，这一步就完成了"></a>③点击确定，这一步就完成了</h4><h3 id="修改配置文件"><a href="#修改配置文件" class="headerlink" title="修改配置文件"></a>修改配置文件</h3><p>用<a href="https://www.runoob.com/linux/linux-vim.html" target="_blank" rel="noopener">vi</a>编辑如下文件</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vi /etc/sysconfig/network-scripts/ifcfg-ens33</span><br></pre></td></tr></table></figure>

<p>修改 BOOTPROTO=static   ONBOOT=yes</p>
<p>新增 IPADDR=192.168.36.10</p>
<p>（如果你无法进行增删的话先按<a href="">A键</a>进入编辑模式即可）<br><strong>要保证虚拟机与本机处于同一个网段</strong> ,即前三位一样，最后一位可以自己定义<br><img src="https://yolin121.oss-cn-beijing.aliyuncs.com/yolin/03128.png" alt=""></p>
<p>ESC回到只读模式，   ：wq！回车</p>
<h3 id="重启网络服务："><a href="#重启网络服务：" class="headerlink" title="重启网络服务："></a>重启网络服务：</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">systemctl restart network</span><br></pre></td></tr></table></figure>
<p><img src="https://yolin121.oss-cn-beijing.aliyuncs.com/yolin/03129.png" alt=""></p>
<h1 id="三、关闭防火墙"><a href="#三、关闭防火墙" class="headerlink" title="三、关闭防火墙"></a>三、关闭防火墙</h1><h3 id="禁止firewall开机启动"><a href="#禁止firewall开机启动" class="headerlink" title="禁止firewall开机启动"></a>禁止firewall开机启动</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">systemctl disable firewalld</span><br></pre></td></tr></table></figure>

<h3 id="查看防火墙状态："><a href="#查看防火墙状态：" class="headerlink" title="查看防火墙状态："></a>查看防火墙状态：</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">systemctl status firewalld </span><br><span class="line">&#x2F;&#x2F;也可使用下面的命令以简单的形式查看</span><br><span class="line">firewall-cmd --state</span><br></pre></td></tr></table></figure>
<p><img src="https://yolin121.oss-cn-beijing.aliyuncs.com/yolin/031210.png" alt=""></p>
<p><strong>管不住你了？？？</strong></p>
<p><img src="https://yolin121.oss-cn-beijing.aliyuncs.com/web_img/201.png" alt=""></p>
<p><a href="">running</a>表示程序正在执行</p>
<p>通过以下命令成功将其关闭<br><img src="https://yolin121.oss-cn-beijing.aliyuncs.com/yolin/031211.png" alt=""></p>
<h1 id="四、关闭selinux（安全套件）"><a href="#四、关闭selinux（安全套件）" class="headerlink" title="四、关闭selinux（安全套件）"></a>四、关闭selinux（安全套件）</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vi &#x2F;etc&#x2F;selinux&#x2F;config</span><br></pre></td></tr></table></figure>

<p>修改：SELINUX=disabled</p>
<p>ESC  :wq! 退出vi编辑模式</p>
<p>查看是否关闭成功可执行<a href="">getenforce</a>   ，如果为<a href="">disabled</a>就是已经关闭</p>
<h1 id="五、修改Linux服务器的主机名"><a href="#五、修改Linux服务器的主机名" class="headerlink" title="五、修改Linux服务器的主机名"></a>五、修改Linux服务器的主机名</h1><p>默认的主机名为localhost.localdomain</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vi /etc/sysconfig/network</span><br></pre></td></tr></table></figure>
<p>HOSTNAME=yolin.xyz</p>
<p>ESC  :wq! 退出vi编辑模式</p>
<h1 id="六、修改主机映射"><a href="#六、修改主机映射" class="headerlink" title="六、修改主机映射"></a>六、修改主机映射</h1><h4 id="windows"><a href="#windows" class="headerlink" title="windows"></a>windows</h4><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">C:\Windows\System32\drivers\etc\hosts</span><br></pre></td></tr></table></figure>
<p>最下面编辑你的ip 以及主机名</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">192.168</span><span class="number">.36</span><span class="number">.10</span> yolin.xyz</span><br></pre></td></tr></table></figure>
<p>（注意这里只有系统管理员可以修改该文件，不会的话自行百度，也可使用火绒里的hosts修改直接操作）</p>
<h4 id="linux"><a href="#linux" class="headerlink" title="linux"></a>linux</h4><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"> vi /etc/hosts </span><br><span class="line"><span class="number">192.168</span><span class="number">.36</span><span class="number">.10</span> yolin.xyz</span><br></pre></td></tr></table></figure>
<p>（修改完测试可在命令行执行ping操作 指令：ping  你的主机名）</p>
<h1 id="七、测试"><a href="#七、测试" class="headerlink" title="七、测试"></a>七、测试</h1><p>久经折磨，终于可以验证是否成功了</p>
<h4 id="打开Xshell6，左上角新建"><a href="#打开Xshell6，左上角新建" class="headerlink" title="打开Xshell6，左上角新建"></a>打开Xshell6，左上角新建</h4><p><img src="https://yolin121.oss-cn-beijing.aliyuncs.com/yolin/031212.png" alt=""></p>
<h4 id="进入身份验证，输入虚拟机的用户名和密码"><a href="#进入身份验证，输入虚拟机的用户名和密码" class="headerlink" title="进入身份验证，输入虚拟机的用户名和密码"></a>进入身份验证，输入虚拟机的用户名和密码</h4><p><img src="https://yolin121.oss-cn-beijing.aliyuncs.com/yolin/031213.png" alt=""></p>
<h4 id="点击确定（这个很重要，点连接会连不上）点击软件上方的打开按钮，选择你的连接"><a href="#点击确定（这个很重要，点连接会连不上）点击软件上方的打开按钮，选择你的连接" class="headerlink" title="点击确定（这个很重要，点连接会连不上）点击软件上方的打开按钮，选择你的连接"></a>点击确定（这个很重要，点连接会连不上）点击软件上方的打开按钮，选择你的连接</h4><p><img src="https://yolin121.oss-cn-beijing.aliyuncs.com/yolin/031214.png?x-oss-process=image/resize,m_fill,h_400,w_400" alt=""></p>
<h4 id="嗨呀！可以点击一次性接收"><a href="#嗨呀！可以点击一次性接收" class="headerlink" title="嗨呀！可以点击一次性接收"></a>嗨呀！可以点击一次性接收</h4><p><img src="https://yolin121.oss-cn-beijing.aliyuncs.com/yolin/031215.png" alt=""></p>
<h4 id="连接成功！！！"><a href="#连接成功！！！" class="headerlink" title="连接成功！！！"></a>连接成功！！！</h4>
      
      <!-- reward -->
      
    </div>
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Centos7/" rel="tag">Centos7</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/IP/" rel="tag">IP</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E8%99%9A%E6%8B%9F%E6%9C%BA/" rel="tag">虚拟机</a></li></ul>


    </footer>

  </div>

  
  
  <nav class="article-nav">
    
      <a href="/2020/03/12/%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6%E8%BD%AF%E4%BB%B6/" class="article-nav-link">
        <strong class="article-nav-caption">上一篇</strong>
        <div class="article-nav-title">
          
            为何要使用版本控制软件？
          
        </div>
      </a>
    
    
      <a href="/2020/03/07/git%E5%88%86%E6%94%AF%E5%88%9D%E4%BD%93%E9%AA%8C/" class="article-nav-link">
        <strong class="article-nav-caption">下一篇</strong>
        <div class="article-nav-title">git分支初体验</div>
      </a>
    
  </nav>


  

  
  
<!-- valine评论 -->
<div id="vcomments-box">
    <div id="vcomments">
    </div>
</div>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src='https://cdn.jsdelivr.net/npm/valine@1.3.10/dist/Valine.min.js'></script>
<script>
    new Valine({
        el: '#vcomments',
        notify: false,
        verify: '',
        app_id: '',
        app_key: '',
        path: window.location.pathname,
        avatar: 'mp',
        placeholder: '给我的文章加点评论吧~',
        recordIP: true
    });
    const infoEle = document.querySelector('#vcomments .info');
    if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
        infoEle.childNodes.forEach(function (item) {
            item.parentNode.removeChild(item);
        });
    }
</script>
<style>
    #vcomments-box {
        padding: 5px 30px;
    }

    @media screen and (max-width: 800px) {
        #vcomments-box {
            padding: 5px 0px;
        }
    }

    #vcomments-box #vcomments {
        background-color: #fff;
    }

    .v .vlist .vcard .vh {
        padding-right: 20px;
    }

    .v .vlist .vcard {
        padding-left: 10px;
    }
</style>

  

  
  
  

</article>
</section>
      <footer class="footer">
  <div class="outer">
    <ul class="list-inline">
      <li>
        &copy;
        2020-2021
        张金
      </li>
      <li>
        
      </li>
    </ul>
    <ul class="list-inline">
      <li>
        
        
        <span>
  <i>PV:<span id="busuanzi_value_page_pv"></span></i>
  <i>UV:<span id="busuanzi_value_site_uv"></span></i>
</span>
        
      </li>
      <li>
        <!-- cnzz统计 -->
        
        <script type="text/javascript" src='https://s9.cnzz.com/z_stat.php?id=1278069914&amp;web_id=1278069914'></script>
        
        <img src="https://yolin121.oss-cn-beijing.aliyuncs.com/blogimg/beian.png">
        <a href="https://beian.miit.gov.cn"  style="color:#f72b07" target="_blank">陕ICP备20002449号</a>
      </li>

    </ul>
  </div>
</footer>
    <div class="to_top">
        <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>
      </div>
    </main>
      <aside class="sidebar">
        <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/"><img src="/images/ayer-side.svg" alt="Yolin"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/">主页</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/archives">归档</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/categories">分类</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags">标签</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/playlist">歌单</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/video">视频</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/about">关于我</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/friends">友情链接</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      <a class="nav-item-link nav-item-search"  title="Search">
        <i class="ri-search-line"></i>
      </a>
      
      
      <a class="nav-item-link" target="_blank" href="/atom.xml" title="RSS Feed">
        <i class="ri-rss-line"></i>
      </a>
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
      </aside>
      <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i>请我喝杯咖啡吧~</p>
  <div class="reward-box">
    
    <div class="reward-item">
      <img class="reward-img" src="/images/alipay.jpg">
      <span class="reward-type">支付宝</span>
    </div>
    
    
    <div class="reward-item">
      <img class="reward-img" src="/images/wechat.jpg">
      <span class="reward-type">微信</span>
    </div>
    
  </div>
</div>
      
<script src="/js/jquery-2.0.3.min.js"></script>


<script src="/js/jquery.justifiedGallery.min.js"></script>


<script src="/js/lazyload.min.js"></script>


<script src="/js/busuanzi-2.3.pure.min.js"></script>


<script src="/js/share.js"></script>




<script>
  try {
    var typed = new Typed("#subtitle", {
    strings: ['肠断月明红豆蔻,','月似当时,','人似当时否？'],
    startDelay: 1500,
    typeSpeed: 200,
    loop: true,
    backSpeed: 40,
    showCursor: true
    });
  } catch (err) {
  }
  
</script>




<script src="/js/tocbot.min.js"></script>

<script>
  // Tocbot_v4.7.0  http://tscanlin.github.io/tocbot/
  tocbot.init({
    tocSelector: '.tocbot',
    contentSelector: '.article-entry',
    headingSelector: 'h1, h2, h3, h4, h5, h6',
    hasInnerContainers: true,
    scrollSmooth: true,
    scrollContainer:'main',
    positionFixedSelector: '.tocbot',
    positionFixedClass: 'is-position-fixed',
    fixedSidebarOffset: 'auto',
    onClick: (e) => {
      $('.toc-link').removeClass('is-active-link');
      $(`a[href=${e.target.hash}]`).addClass('is-active-link');
      $(e.target.hash).scrollIntoView();
      return false;
    }
  });
</script>


<script>
  var ayerConfig = {
    mathjax: true
  }
</script>


<script src="/js/ayer.js"></script>


<script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css">


<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.css">
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>

<script>
    function viewer_init() {
        let pswpElement = document.querySelectorAll('.pswp')[0];
        let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))

        $imgArr.forEach(($em, i) => {
            $em.onclick = () => {
                // slider展开状态
                // todo: 这样不好，后面改成状态
                if (document.querySelector('.left-col.show')) return
                let items = []
                $imgArr.forEach(($em2, i2) => {
                    let img = $em2.getAttribute('data-idx', i2)
                    let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
                    let title = $em2.getAttribute('alt')
                    // 获得原图尺寸
                    const image = new Image()
                    image.src = src
                    items.push({
                        src: src,
                        w: image.width || $em2.width,
                        h: image.height || $em2.height,
                        title: title
                    })
                })
                var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
                    index: parseInt(i)
                });
                gallery.init()
            }
        })
    }
    viewer_init()
</script>



<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
      tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
  });

  MathJax.Hub.Queue(function() {
      var all = MathJax.Hub.getAllJax(), i;
      for(i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
      }
  });
</script>

<script src="https://cdn.jsdelivr.net/npm/mathjax@2.7.6/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>


<script type="text/javascript" src="https://js.users.51.la/20544303.js"></script>
  </div>
</body>

</html>